/**
 * index
 */
define(function(require) {
    var $ = require('jquery');
    var com = require('./common');



    var myapp = new Vue({
        el:'#app',
        data:{
            my_input:'wwww',
            my_textarea:'',
            my_checked:'',
            a:'a',
            b:'b',
            my_checkedNames:[],
            my_radio:'',
            my_select:''
        }
    });



    

    var kcid = '123456';
    var myapp1 = new Vue({
        el:'#app1',
        data:{
            cates:'',
            map:{
                kcid:kcid,
                yxid:'',
                kcmc:''
            }
        },
        watch:{
            'map.yxid':function(new_val,old_val){
                console.warn('新分类：'+ new_val);
                console.warn('旧分类：'+ old_val);
            },
            'map.kcmc':function(new_val,old_val){
                console.log('新名称：'+ new_val);
                console.log('旧名称：'+ old_val);
            }
        },
        methods:{
            initCates:function(){
                var _this = this;
                //最新课程
                axios.get('/test/test2.json',{params:{c1:0,c2:0,c3:0}}).then(function(response){
                    var result = response.data;
                    _this.cates = result.data;  //渲染数据

                    axios.get('/test/test3.json',{params:{kcid:kcid}}).then(function(response){
                        var result = response.data;                        
                        _this.map.kcmc = result.data.kcmc;      //渲染数据
                        _this.map.yxid = result.data.yxid;      //渲染数据
                    });

                });
            },
            submitDate:function(){
                //提交数据
                axios.post('/test/test.json',this.map).then(function(response){ 
                    //success callback
                    if(response.data.status == 0){
                        console.warn('提交成功');
                    }
                });
            }
        },
        created:function(){
            this.$nextTick(function(){
                this.initCates();
            })
        }
    });



    
});